package com.future.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.future.domain.Certification;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CertificationMapper extends BaseMapper<Certification> {
    @Select("SELECT * FROM certification" +
            " WHERE (real_name LIKE CONCAT('%', #{keyword}, '%') " +
            "     OR id_card LIKE CONCAT('%', #{keyword}, '%')" +
            "     OR role LIKE CONCAT('%', #{keyword}, '%'))" +
            " ORDER BY applied_at DESC")
    Page<Certification> searchCertifications(Page<Certification> page, @Param("keyword") String keyword);
}
